package team.szm.scd.database.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import team.szm.scd.database.entity.Doctor;
import team.szm.scd.database.properties.AppointmentTimeType;
import team.szm.scd.database.vo.DoctorVO;

import java.time.DayOfWeek;
import java.util.List;

@Repository
public interface DoctorMapper extends BaseMapper<Doctor> {
//    @Select("SELECT password, " +
//            "dname as name, expert, hname as hospitalName, dpname as departmentName \n" +
//            "FROM doctor join department d on doctor.dpid = d.dpid join hospital h on h.hid = doctor.hid \n" +
//            "WHERE did=#{id}")
//    DoctorVO doctorFromId(@Param("id") String id);

    @Select("SELECT password, " +
            "dname as name, expert, hname as hospitalName, dpname as departmentName," +
            "hid as hospitalId, did as id \n" +
            "FROM doctor natural join department d natural join hospital h \n" +
            " ${ew.customSqlSegment}")
    List<DoctorVO> doctorsFromQueryWrapper(@Param("ew") Wrapper<DoctorVO> wrapper);
}
